package com.tang.javaSwingCaculate.CaculateGUI;

import javax.swing.*;
import java.awt.*;

/**
 * @author tmh
 * @date 2022/12/9 15:46
 * @description 计算器的图形化界面
 */
public class GUI {
    public static void main(String[] args) {
        //确保一个漂亮的外观风格
        JFrame.setDefaultLookAndFeelDecorated(true);
        //创建以及设置窗口
        JFrame jf = new JFrame("myTestSwing");
        jf.setBounds(400, 400, 800, 900);
        jf.setLayout(new GridLayout(3, 3, 10, 20));//网格布局


        jf.setVisible(true);
        jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    }
}

class MyLayOut {
    public static void main(String[] args) {

        //确保一个漂亮的外观风格
        JFrame.setDefaultLookAndFeelDecorated(true);
        //创建以及设置窗口
        JFrame jf = new JFrame("myTestSwing");
        jf.setBounds(400, 400, 800, 900);
        jf.setLayout(new GridLayout(4, 3, 10, 20));//网格布局

        JButton[] jButtons = new JButton[10];
        for (int i = 0; i < 10; i++) {
            jButtons[i] = new JButton(String.valueOf(i));
        }
        for (int i = 0; i < 10; i++) {
            jf.add(jButtons[i]);
        }

        jf.setVisible(true);
        jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);


    }
}


